﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AcctruePMS.Bll.Manager;
using AcctrueWMS.Foundation.DAL;
using am.Charts;   


namespace AcctruePMS.Web
{
    public partial class desktop_projectReport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dtProject = WMSqlExcuter.ExecuteDataTable(" SELECT  a.[COUNT] as NUM, a.status,b.dictValue AS   statusValue FROM  (SELECT     status , COUNT(1)    AS COUNT  FROM project    GROUP BY   status  ) a "
            +"LEFT JOIN  (SELECT  dictValue, dictKey  FROM dbo.sys_dictionary_items WHERE  dictName='projectStatus' ) AS b  ON a.status =b.dictKey  ");
            foreach (DataRow row in dtProject.Rows)
            {
                //PieChartDataItem pcd = new PieChartDataItem("攀哥" + i.ToString(), i);
                PieChartDataItem pcd1 = new PieChartDataItem();
                //  pcd1.Description = "Description" + i.ToString();
                //显示标签
                pcd1.Title = row["statusValue"].ToString();
                //设置点击时候的链接
                //   pcd1.Url = "http://http://localhost/AcctrueWMS/";
                // 饼图半径
                pcd1.LabelRadius = 1;
                //实际数量    百分之几。分割之后 不用你自己计算 应该都封装 计算百分比的方法了
                pcd1.Value = row["NUM"].ToString();
                // 一块块的是否突出 整出来
                pcd1.PullOut = false;
                PieChart1.Items.Add(pcd1);
            }
            PieChart1.Width = 500;
            PieChart1.Height = 500;
            //设置链接的跳转方式
            //PieChart1.SliceLinkTarget = "_blank";
            PieChart1.ScientificMax = 50;
            PieChart1.Labels.Add(new ChartLabel("项目状态分布图", new Unit(100), new Unit(20)));
            PieChart1.ToolTip = "项目状态分布图2";
        }
    }
}
